<template>
	<view>
		<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30 u-m-t-20">
			<view class="u-m-r-10">
				<u-avatar
					src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsngedu-punch-1251502357.cos.ap-guangzhou.myqcloud.com%2Fagency_picurl%2FQFzQYCgCrxmeXicuR6JnsP153UAFZbcic3G7EKm7rOlrcMgPhLeODwNM81abKGTLkd&refer=http%3A%2F%2Fsngedu-punch-1251502357.cos.ap-guangzhou.myqcloud.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669359479&t=17cdc5ff9204bc85cbfe0d44af4f9753"
					size="140"
				></u-avatar>
			</view>
			<view class="u-flex-1">
				<view class="u-font-18 u-p-b-20" style="left:300;">余 额 ：{{ card.cardMoney }} 元</view>
				<view class="u-font-14 u-tips-color">卡 号 : {{ card.cardNum}}</view>
			</view>
			<view>
				<view style="margin-left: 15px;margin-right: 25px;">
					
					<u-tag v-if="card.cardStatus=='y'" text="正常" type="success"></u-tag>
					<u-tag v-if="card.cardStatus=='n'" text="挂失" type="error"></u-tag>
					
					
					
					
					</view>
			</view>
		</view>

		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="rmb-circle" title="充值" @click="HxGopage('/pages/card/cardIn',card.id)"></u-cell-item>
			</u-cell-group>
		</view>

		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="star" title="消费记录" @click="HxGopage('/pages/card/cardOutList',card.id)"></u-cell-item>
				<u-cell-item icon="photo" title="充值记录" @click="HxGopage('/pages/card/cardInList',card.id)"></u-cell-item>
			</u-cell-group>
		</view>

		<view class="u-m-t-20">
			<u-cell-group><u-cell-item icon="setting" title="设置" @click="HxGopage('/pages/card/cardSetting',card.id)" ></u-cell-item></u-cell-group>
		</view>
	</view>
</template>

<script>
export default {
	onLoad(studentId) {		
		this.student.id=studentId.studentId;
	},
	data() {
		return {
			student:{
				id:null,
			},
			cardIn: {
				inMachineId: 4,
				inMoney: null,
				card: null
			},
			card: {
				id: null,
				cardNum: null,
				cardMoney: null,
				cardStatus:null,
				student: {
					studentNumber: null,
					name: null
				}
			}
		};
	},
	onPullDownRefresh(){
		this.get();
		uni.stopPullDownRefresh()
	},
	methods: {
		HxGopage(url,o) {
			uni.navigateTo({
				url: url+`?id=${o}`
			})
		},
		get(){
			this.$axios({
				method: 'post',
				url: '/api/card/getById',
				data: this.card
			}).then(r => {
				if (r.data.code == 200) {
					this.card = r.data.data;
				}
			});
		}
	},
	created() {
		this.$axios({
			method: 'post',
			url: '/api/card/getByStudentId',
			data: this.student
		}).then(r => {
			if (r.data.code == 200) {
				this.card=r.data.data				
			}
		});
		
	}
};
</script>

<style lang="scss">
page {
	background-color: #ededed;
}

.camera {
	width: 54px;
	height: 44px;

	&:active {
		background-color: #ededed;
	}
}
.user-box {
	background-color: #fff;
}
</style>
